<template>
  <div class="course-hot-card">
    <div class="pic" @click="navigateTo('/course/index', {id: `${courseId}`})">
      <img crossorigin="anonymous" :src="courseImg" />
    </div>
    <div class="content">
      <div class="name" :title="courseTitle" @click="navigateTo('/course/index', {id: `${courseId}`})">{{courseTitle}}</div>
      <div class="section-info">共{{ videoNum>=curVideoNum ? videoNum : curVideoNum }}讲  更新到{{ curVideoNum }}讲</div>
    </div>
  </div>
</template>

<script>
import { useNavigation } from "@utils/navigation";

export default {
  name: 'CourseHotCard',
  props: {
    courseId: String,
    courseImg: String,
    courseTitle: String,
    videoNum: Number,
    curVideoNum: Number,
  },
  data () {
    return {
    }
  },
  setup () {
    const { navigateTo } = useNavigation();
    return {
      navigateTo
    }
  },
}
</script>

<style lang="less" scoped>
.course-hot-card {
  width: 100%;
  height: 80px;
  display: flex;

  .pic {
    width: 142px;
    height: 80px;
    cursor: pointer;

    img {
      width: 100%;
      height: 100%;
      border-radius: 8px;
    }
  }

  .content {
    flex: 1;
    padding-left: 12px;

    .name {
      height: 42px;
      line-height: 22px;
      font-size: 16px;
      color: @font-black;
      font-weight: 500;
      overflow: hidden;
      text-overflow: ellipsis;
      cursor: pointer;
    }

    .section-info {
      height: 14px;
      line-height: 14px;
      font-size: 14px;
      color: @font-grey-light;
      padding-top: 24px;
    }
  }
}
</style>
